import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter2/widget/base/normal_edit.dart';
import 'package:flutter2/widget/base/normal_text.dart';

import '../colors.dart';
import 'base/base_container.dart';

class InfoEdit extends StatelessWidget {
  const InfoEdit({
    super.key,
    required this.title,
    this.hint,
    this.controller,
    this.inputFormatters,
    this.inputType,
  });

  final String title;
  final String? hint;
  final TextEditingController? controller;
  final List<TextInputFormatter>? inputFormatters;
  final TextInputType? inputType;

  @override
  Widget build(BuildContext context) {
    return BaseContainer(
      width: double.infinity,
      radius: 10,
      background: Colors.white,
      margin: EdgeInsets.symmetric(horizontal: 16, vertical: 10),
      padding: EdgeInsets.symmetric(horizontal: 16, vertical: 10),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          NormalText(
            text: title,
            fontSize: 14,
            fontColor: mainText,
          ),
          NormalEdit(
            fontSize: 14,
            hintText: hint ?? "请输入",
            hintFontColor: mainText2,
            controller: controller,
            inputType: inputType,
            inputFormatters: inputFormatters,
            padding: EdgeInsets.symmetric(vertical: 10),
          ),
          BaseContainer(
            height: 1,
            width: double.infinity,
            background: line,
          )
        ],
      ),
    );
  }
}
